/**
    ATClab - scriptable Air Traffic Control simulations.
    Copyright (C) 2010 openatclab@gmail.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
**/

#ifndef __ATC_ENGINE_HDR__ 
#define __ATC_ENGINE_HDR__

// define dll interface
#ifdef WIN32
	#include <windows.h>
//	#ifdef ATC_EXPORTS
//		#define ATC_API __declspec(dllexport)
//	#else
//		#define ATC_API __declspec(dllimport)
//	#endif
//#else
	#define ATC_API
#endif


#include <qobject.h>

// include interfaces for setting up engine
#include "param.h"
#include "map.h"
#include "sky.h"
#include "taskfactory.h"

/*!
 * \class QWidget
 */
class QWidget;

namespace atc{

	/*!
	 * class atc::Engine atc_engine.h
	 *
	 * @todo document this interface
	 */
	class ATC_API Engine : public QObject {
		Q_OBJECT

	public:
		virtual ~Engine(){};

		virtual atc::Param& param() = 0;
		virtual atc::Map& map() = 0;
		virtual atc::Sky& sky() = 0;

		virtual QWidget* create_view(QWidget*, const char*) = 0;

		virtual void set_alarm( int, QObject *, const char * ) = 0;


	public slots:
		virtual void init() = 0;
		virtual void start() = 0;
		virtual void stop() = 0;
		virtual void reset() = 0;
		virtual void clear() = 0;

	signals:
		void tick(unsigned long);
		void timed_out(unsigned long);
		void timed_out();
		void conflicts();
		void TrialScore(long a_score);
	};

	typedef atc::Engine* create_t();
	typedef void destroy_t(atc::Engine*);

}

//#ifdef
	extern "C" ATC_API atc::Engine* create_engine(pact::TrialTaskType a_type);
	extern "C" ATC_API void destroy_engine(atc::Engine* e);
//#endif

#endif
